]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
gdm: Fix regression where domain login hint not shown
authorStef Walter <stefw@gnome.org>
Fri, 19 Apr 2013 07:07:04 +0000 (09:07 +0200)
committerStef Walter <stefw@gnome.org>
Fri, 3 May 2013 19:59:57 +0000 (21:59 +0200)
Also only keep around realmd while we're actually using it, allow it
to quit if no other clients are active.

https://bugzilla.gnome.org/show_bug.cgi?id=698200

js/gdm/loginDialog.js
js/gdm/realmd.js
js/gdm/util.js

index c023f4c8edba6a0fea379fe4e7c98aa18bcb3f29..f9c5894c48555afdfcdc43393b79ca6f8a49c197 100644 (file)
@@ -28,6 +28,7 @@ const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
 const Lang = imports.lang;
 const Pango = imports.gi.Pango;
+const Realmd = imports.gdm.realmd;
 const Signals = imports.signals;
 const Shell = imports.gi.Shell;
 const St = imports.gi.St;
@@ -914,17 +915,40 @@ const LoginDialog = new Lang.Class({
         return batch.run();
     },
 
+    _showRealmLoginHint: function(realmManager, hint) {
+        if (!hint)
+            return;
+
+        hint = hint.replace(/%U/g, 'user');
+        hint = hint.replace(/%D/g, 'DOMAIN');
+        hint = hint.replace(/%[^UD]/g, '');
+
+        // Translators: this message is shown below the username entry field
+        // to clue the user in on how to login to the local network realm
+        this._showLoginHint(null, _("(e.g., user or %s)").format(hint));
+    },
+
     _askForUsernameAndLogIn: function() {
         this._promptLabel.set_text(_("Username: "));
         this._promptEntry.set_text('');
         this._promptEntry.clutter_text.set_password_char('');
 
+        let realmManager = new Realmd.Manager();
+        let signalId = realmManager.connect('login-format-changed',
+                                               Lang.bind(this, this._showRealmLoginHint));
+        this._showRealmLoginHint(realmManager.loginFormat);
+
         let tasks = [this._showPrompt,
 
                      function() {
                          let userName = this._promptEntry.get_text();
                          this._promptEntry.reactive = false;
                          return this._beginVerificationForUser(userName);
+                     },
+
+                     function() {
+                         realmManager.disconnect(signalId)
+                         realmManager.release();
                      }];
 
         let batch = new Batch.ConsecutiveBatch(this, tasks);
index e64b0b27b3fa15cb2770a9d670f0bbb29f19b618..78c94b4bef98af86cec2fea6badd96c7c7473ca1 100644 (file)
@@ -63,7 +63,7 @@ const Manager = new Lang.Class({
                                            Lang.bind(this, this._reloadRealms))
         this._realms = {};
 
-        this._aggregateProvider.connect('g-properties-changed',
+        this._signalId = this._aggregateProvider.connect('g-properties-changed',
                                         Lang.bind(this, function(proxy, properties) {
                                             if ('Realms' in properties.deep_unpack())
                                                 this._reloadRealms();
@@ -106,7 +106,7 @@ const Manager = new Lang.Class({
         realm.connect('g-properties-changed',
                       Lang.bind(this, function(proxy, properties) {
                                 if ('Configured' in properties.deep_unpack())
-                                    this._reloadRealm();
+                                    this._reloadRealm(realm);
                                 }));
     },
 
@@ -134,6 +134,18 @@ const Manager = new Lang.Class({
         this._updateLoginFormat();
 
         return this._loginFormat;
+    },
+
+    release: function() {
+        Service(Gio.DBus.system,
+                'org.freedesktop.realmd',
+                '/org/freedesktop/realmd',
+                function(service) {
+                    service.ReleaseRemote();
+                });
+        this._aggregateProvider.disconnect(this._signalId);
+        this._realms = { };
+        this._updateLoginFormat();
     }
 });
 Signals.addSignalMethods(Manager.prototype)
index 36ee4abed3d34d56917ce85f6d3ce7aa2938481e..6075e660f95071fe4c5a0c112452cce893f038d0 100644 (file)
@@ -9,7 +9,6 @@ const Signals = imports.signals;
 
 const Batch = imports.gdm.batch;
 const Fprint = imports.gdm.fingerprint;
-const Realmd = imports.gdm.realmd;
 const Main = imports.ui.main;
 const Params = imports.misc.params;
 const Tweener = imports.ui.tweener;
@@ -117,7 +116,6 @@ const ShellUserVerifier = new Lang.Class({
         this._settings = new Gio.Settings({ schema: LOGIN_SCREEN_SCHEMA });
 
         this._fprintManager = new Fprint.FprintManager();
-        this._realmManager = new Realmd.Manager();
         this._messageQueue = [];
         this._messageQueueTimeoutId = 0;
         this.hasPendingMessages = false;
@@ -377,30 +375,11 @@ const ShellUserVerifier = new Lang.Class({
         this._queueMessage(problem, 'login-dialog-message-warning');
     },
 
-    _showRealmLoginHint: function() {
-        if (this._realmManager.loginFormat) {
-            let hint = this._realmManager.loginFormat;
-
-            hint = hint.replace(/%U/g, 'user');
-            hint = hint.replace(/%D/g, 'DOMAIN');
-            hint = hint.replace(/%[^UD]/g, '');
-
-            // Translators: this message is shown below the username entry field
-            // to clue the user in on how to login to the local network realm
-            this.emit('show-login-hint',
-                      _("(e.g., user or %s)").format(hint));
-        }
-    },
-
     _onInfoQuery: function(client, serviceName, question) {
         // We only expect questions to come from the main auth service
         if (serviceName != PASSWORD_SERVICE_NAME)
             return;
 
-        this._showRealmLoginHint();
-        this._realmLoginHintSignalId = this._realmManager.connect('login-format-changed',
-                                                                  Lang.bind(this, this._showRealmLoginHint));
-
         this.emit('ask-question', serviceName, question, '');
     },
 
@@ -476,11 +455,6 @@ const ShellUserVerifier = new Lang.Class({
         }
 
         this.emit('hide-login-hint');
-
-        if (this._realmLoginHintSignalId) {
-            this._realmManager.disconnect(this._realmLoginHintSignalId);
-            this._realmLoginHintSignalId = 0;
-        }
     },
 });
 Signals.addSignalMethods(ShellUserVerifier.prototype);